package com.li.service;

import com.li.mapper.RequireMapper;
import com.li.pojo.Require;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class RequireService {

    @Autowired
    RequireMapper requireMapper;

    public Require queryRequire(Require require){
        return requireMapper.queryRequire(require);
    }

    public boolean addRequire(Require require){
        if(requireMapper.queryRequireByRno(require)==null){
            requireMapper.insertRequire(require);
            return  true;
        }
        return false;
    }

    public boolean deleteRequire(Require require){
        if(requireMapper.queryRequire(require)!=null){
            requireMapper.deleteRequire(require);
            return true;
        }
        return false;
    }
    public boolean updateRequire(Require require){
        requireMapper.updateRequire(require);
        return  true;
    }
    public List<Require> allRequire(){
        return requireMapper.listRequire();
    }
}
